package com.letv.core.bean;

import android.text.TextUtils;

import com.letv.component.player.utils.NativeInfos;
import com.letv.core.utils.LogInfo;
import com.letv.core.utils.PlayUtils.PLAY_LEVEL;
import java.util.HashMap;
import java.util.Map;

/**
 * 调度地址
 * 
 * @author zhuqiao
 *
 */
public class VideoFileBean implements LetvBaseBean {
    private static final long serialVersionUID = 1L;
    // header['status'] = 6 代表IP被屏蔽,body['country']代表国家,body['message']代表文案(version=5.3.1)
    /**
     * 国家
     */
    private String country;

    /**
     * 提示文案
     */
    private String message;
    /**
     * 资源id
     * */
    private String mmsid;
    /**
     * 是否降码流status: 0-否，1-是
     */
    private String status;

    /**
     * 要将到的码流,即指定为infos中的码流key,如：mp4_350,mp4_1000
     */
    private VideoSchedulingAddress descendLevel;

    /**
     * 流畅350
     * */
    private VideoSchedulingAddress mp4_180;
    /**
     * 标清350
     * */
    private VideoSchedulingAddress mp4_350;

    /**
     * 高清1000
     * */
    private VideoSchedulingAddress mp4_1000;

    /**
     * 超清1300
     * */
    private VideoSchedulingAddress mp4_1300;

    /**
     * 杜比800
     */
    private VideoSchedulingAddress mp4_800_db;

    /**
     * 杜比1300
     */
    private VideoSchedulingAddress mp4_1300_db;

    /**
     * 杜比720p
     */
    private VideoSchedulingAddress mp4_720p_db;

    /**
     * 杜比1080p
     */
    private VideoSchedulingAddress mp4_1080p6m_db;

    /**
     * H265 800码流
     */
    private VideoSchedulingAddress h265_flv_800;

    /**
     * H265 1300码流
     */
    private VideoSchedulingAddress h265_flv_1300;

    /**
     * H265 720p码流
     */
    private VideoSchedulingAddress h265_flv_720p;

    /**
     * H265 1080p码流
     */
    private VideoSchedulingAddress h265_flv_1080p;
    /**
     * ip是否被屏蔽
     */
    private boolean isIpEnable = false;
    /**
     * 是否降低码流：0-否，1-是
     */
    private boolean isDeclineStream = false;

    /**
     * 降到的码流值key，例如：mp4_350,mp4_1000
     * 配合isDeclineStream使用
     */
    private String declineStreamLevel;

    public HashMap<Integer,String>  streamLevelMaps = new HashMap<Integer,String>();

    /**
     * 是否错误
     */
    private boolean isErr;

    public boolean isErr() {
        return isErr;
    }

    public VideoFileBean setErr(boolean isErr) {
        this.isErr = isErr;
        return this;
    }
    
    public boolean isIpEnable() {
        return isIpEnable;
    }

    public void setIpEnable(boolean isIpEnable) {
        this.isIpEnable = isIpEnable;
    }

    public String getMmsid() {
        return mmsid;
    }

    public void setMmsid(String mmsid) {
        this.mmsid = mmsid;
    }

    public VideoSchedulingAddress getMp4_1080p6m_db() {
        return mp4_1080p6m_db;
    }

    public void setMp4_1080p6m_db(VideoSchedulingAddress mp4_1080p6m_db) {
        this.mp4_1080p6m_db = mp4_1080p6m_db;
    }

    public VideoSchedulingAddress getMp4_800_db() {
        return mp4_800_db;
    }

    public void setMp4_800_db(VideoSchedulingAddress mp4_800_db) {
        this.mp4_800_db = mp4_800_db;
    }

    public VideoSchedulingAddress getMp4_1300_db() {
        return mp4_1300_db;
    }

    public void setMp4_1300_db(VideoSchedulingAddress mp4_1300_db) {
        this.mp4_1300_db = mp4_1300_db;
    }

    public VideoSchedulingAddress getMp4_720p_db() {
        return mp4_720p_db;
    }

    public void setMp4_720p_db(VideoSchedulingAddress mp4_720p_db) {
        this.mp4_720p_db = mp4_720p_db;
    }

    public VideoSchedulingAddress getMp4_180() {
        return mp4_180;
    }

    public void setMp4_180(VideoSchedulingAddress mp4_180) {
        this.mp4_180 = mp4_180;
    }

    public VideoSchedulingAddress getMp4_350() {
        return mp4_350;
    }

    public void setMp4_350(VideoSchedulingAddress mp4_350) {
        this.mp4_350 = mp4_350;
    }

    public VideoSchedulingAddress getMp4_1000() {
        return mp4_1000;
    }

    public void setMp4_1000(VideoSchedulingAddress mp4_1000) {
        this.mp4_1000 = mp4_1000;
    }

    public VideoSchedulingAddress getMp4_1300() {
        return mp4_1300;
    }

    public void setMp4_1300(VideoSchedulingAddress mp4_1300) {
        this.mp4_1300 = mp4_1300;
    }

    public VideoSchedulingAddress getH265_flv_800() {
        return h265_flv_800;
    }

    public void setH265_flv_800(VideoSchedulingAddress h265_flv_800) {
        this.h265_flv_800 = h265_flv_800;
    }

    public VideoSchedulingAddress getH265_flv_1300() {
        return h265_flv_1300;
    }

    public void setH265_flv_1300(VideoSchedulingAddress h265_flv_1300) {
        this.h265_flv_1300 = h265_flv_1300;
    }

    public VideoSchedulingAddress getH265_flv_720p() {
        return h265_flv_720p;
    }

    public void setH265_flv_720p(VideoSchedulingAddress h265_flv_720p) {
        this.h265_flv_720p = h265_flv_720p;
    }

    public VideoSchedulingAddress getH265_flv_1080p() {
        return h265_flv_1080p;
    }

    public void setH265_flv_1080p(VideoSchedulingAddress h265_flv_1080p) {
        this.h265_flv_1080p = h265_flv_1080p;
    }

    /**
     * @return the country
     */
    public String getCountry() {
        return country;
    }

    /**
     * @param country the country to set
     */
    public void setCountry(String country) {
        this.country = country;
    }

    /**
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * @param message the message to set
     */
    public void setMessage(String message) {
        this.message = message;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public VideoSchedulingAddress getDescendLevel() {
        return descendLevel;
    }

    public void setDescendLevel(VideoSchedulingAddress level) {
        this.descendLevel = level;
    }

    public boolean isDeclineStream() {
        return isDeclineStream;
    }

    public void setDeclineStream(boolean isDeclineStream) {
        this.isDeclineStream = isDeclineStream;
    }

    public int getDeclineStreamLevel() {
        int level = PLAY_LEVEL.STANDARD;
        if ("mp4_180".equalsIgnoreCase(declineStreamLevel)) {
            level = PLAY_LEVEL.LOW;
        } else if ("mp4_350".equalsIgnoreCase(declineStreamLevel)) {
            level = PLAY_LEVEL.STANDARD;
        } else if ("mp4_1000".equalsIgnoreCase(declineStreamLevel)) {
            level = PLAY_LEVEL.HIGH;
        } else if ("mp4_1300".equalsIgnoreCase(declineStreamLevel)) {
            level = PLAY_LEVEL.SUPERHIGH;
        }

        return level;
    }

    public void setDeclineStreamLevel(String declineStreamLevel) {
        this.declineStreamLevel = declineStreamLevel;
    }

    public static class VideoSchedulingAddress implements LetvBaseBean {
        private static final long serialVersionUID = 1L;

        /**
         * 主调度地址
         * */
        private String mainUrl;
        /**
         * 备用地址1
         * */
        private String backUrl0;
        /**
         * 备用地址2
         * */
        private String backUrl1;
        /**
         * 备用地址3
         * */
        private String backUrl2;
        /**
         * 文件大小
         * */
        private long filesize;

        /**
         * 视频文件名称
         */
        private String storepath;

        public String getStorepath() {
            return storepath;
        }

        public void setStorepath(String storepath) {
            this.storepath = storepath;
        }

        public String getMainUrl() {
            if (TextUtils.isEmpty(mainUrl)) {
                return null;
            }
            return mainUrl;
        }

        public void setMainUrl(String mainUrl) {
            this.mainUrl = mainUrl;
        }

        public String getBackUrl0() {
            if (TextUtils.isEmpty(backUrl0)) {
                return null;
            }
            return backUrl0;
        }

        public void setBackUrl0(String backUrl0) {
            this.backUrl0 = backUrl0;
        }

        public String getBackUrl1() {
            if (TextUtils.isEmpty(backUrl1)) {
                return null;
            }
            return backUrl1;
        }

        public void setBackUrl1(String backUrl1) {
            this.backUrl1 = backUrl1;
        }

        public String getBackUrl2() {
            if (TextUtils.isEmpty(backUrl2)) {
                return null;
            }
            return backUrl2;
        }

        public void setBackUrl2(String backUrl2) {
            this.backUrl2 = backUrl2;
        }

        public long getFilesize() {
            return filesize;
        }

        public void setFilesize(long filesize) {
            this.filesize = filesize;
        }

        @Override
        public String toString() {
            return "mainUrl--filesize---storepath---" + mainUrl + "\n" + filesize + "\n" + storepath;
        }
    }

}
